import {RouteRecordRaw} from "vue-router";

export interface LoginStoreState{
    tokenInfo: TokenInfo
    userInfo: UserInfo
    userMenus: UserMenus[],
    permission: string[],
    isRefresh: boolean
}

export interface LoginStoreActions{
    accountLogin: (account: LoginParams) => any
    mobileLogin: (params: MobileParams) => any
    queryUserPrincipal: () => void
    queryMyMenu: () => void
    loadFromLocal: () => void
    refreshToken: () => Promise<any>
}

export interface LoginParams{
    username: string,
    password: string
}

export interface MobileParams{
    mobile: string,
    code: string
}


export interface TokenInfo{
    accessToken?: string,
    refreshToken?: string,
    accessTokenExpAt?: number,
    refreshTokenExpAt?: number,
    jti?: string
}


export interface UserInfo{
    id?: string,
    username?: string,
    nickName?: string,
    email?: string,
    mobile?: string,
    loginIp?: string,
    jti?: string,
    loginTime?: Date | null | undefined,
    avatar?: string|undefined|null,
    roles?: string[]
}

export interface UserMenus{
    id?: string,
    name?: string,
    code?: string,
    url?: string,
    pid?: string,
    level?: number,
    component?: string,
    type?: number,
    orderNum?: number,
    icon?: string,
    description?: string,
    createTime?: Date,
    createBy?: string,
    updateTime?: Date,
    updateBy?: string,
    available?: boolean,
    children?: UserMenus[]
}
